let obj = {
  name: 'xiaolidu',
  age: 20,
  hobbies: {
    sports: ['游泳', '洗澡', '睡觉'],
    music: ['lost-river', 'jinitaimei']
  },
  birthday: new Date('2020/12/20 20:30:30'),
  say: function () {
    console.log('我的名字是' + this.name);
  },
}
Object.defineProperty(obj, 'power', {
  value: '飞',
  enumerable: false
})
function People () {
  this.do = '吃饭'
}
obj.__proto__ = new People()
console.log(obj);
console.log('自身可枚举', Object.keys(obj)); // [ 'name', 'age', 'hobbies', 'birthday','say' ] // 只是得到自身的可枚举的属性
console.log('自身可枚举不可枚举', Object.getOwnPropertyNames(obj)); // 也是没有继承的属性
let result = []
for (let key in obj) {
  result.push(key) // 这样的话就会有继承的属性了
}
console.log('自身和原型链可枚举', result);
// 遍历对象的所有属性
result.forEach((item) => {
  console.log(obj[item]);
})
